<?php
namespace Home\Controller;
use Think\Controller;
class NewsController extends Controller {
    public function index(){
    	$banner=M('banner');
        $bannerlist=$banner->select();
        $this->assign("bannerlist",$bannerlist);
        // 查询新闻
        $news=M('news');
        $type=isset($_GET['type'])?$_GET['type']:'1';
        $this->assign("type",$type);
        $newslist=$news->where("type=".$type)->order('time desc')->limit(14)->select();
        $newslist1 = $news->where('type=1')->order('time desc')->limit(10)->select();
        $newslist2 = $news->where('type=2')->order('time desc')->limit(10)->select();
        $newslist3 = $news->where('type=3')->order('time desc')->limit(10)->select();
        $this->assign("newslist",$newslist1[0]);
        $this->assign("newslist",$newslist2[0]);
        $this->assign("newslist",$newslist3[0]);
        $this->assign("newslist",$newslist);
        $this->display();
    }
}